package com.cloudeye.apigateway.component;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.route.RouteDefinition;
import org.springframework.cloud.gateway.route.RouteDefinitionRepository;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.net.URI;

//@Component
@Slf4j
public class RedisRouteDefRepository implements RouteDefinitionRepository {
    @SneakyThrows
    @Override
    public Flux<RouteDefinition> getRouteDefinitions() {
        RouteDefinition def = new RouteDefinition();
        def.setId("firstOne");
        def.setUri(new URI("http://www.baidu.com"));
        return Flux.just(def);
    }

    @Override
    public Mono<Void> save(Mono<RouteDefinition> route) {
        return null;
    }

    @Override
    public Mono<Void> delete(Mono<String> routeId) {
        return null;
    }
}
